gdk/surface: Allow inhibit layout from backend
authorJonas Ådahl <jadahl@gmail.com>
Fri, 4 Dec 2020 23:11:08 +0000 (00:11 +0100)
committerJonas Ådahl <jadahl@gmail.com>
Mon, 7 Dec 2020 19:37:29 +0000 (20:37 +0100)
If compute_size() returns TRUE, the layout will not be propagated to
GTK. This will be used by the X11 backend to queue asynchronous resizes
that shouldn't yet allocate in GTK.

gdk/gdksurface.c
gdk/gdksurfaceprivate.h
gdk/wayland/gdksurface-wayland.c
gdk/x11/gdksurface-x11.c

index fd2d0772e8b434b2cfa0ae2b399243d27ca895cf..27b775982c08e7e27cd1f2a1c3863f2a06407e3c 100644 (file)
@@ -1340,7 +1340,10 @@ gdk_surface_layout_on_clock (GdkFrameClock *clock,
 
   class = GDK_SURFACE_GET_CLASS (surface);
   if (class->compute_size)
-    class->compute_size (surface);
+    {
+      if (class->compute_size (surface))
+        return;
+    }
 
   g_signal_emit (surface, signals[LAYOUT], 0, surface->width, surface->height);
 }
index 4fb40a376b0b02038e59e51658fd3edf88156658..4c879fc2cb63627829a1c9c01b4d3dba19d76ed3 100644 (file)
@@ -162,7 +162,7 @@ struct _GdkSurfaceClass
                                            GdkGLContext   *share,
                                            GError        **error);
   void         (* request_layout)         (GdkSurface     *surface);
-  void         (* compute_size)           (GdkSurface     *surface);
+  gboolean     (* compute_size)           (GdkSurface     *surface);
 };
 
 #define GDK_SURFACE_DESTROYED(d) (((GdkSurface *)(d))->destroyed)
index 6ad40c39cdca3b5e6182dbf3b52a7894684d4163..c152acf3e582c14cbb5323b6403132dac5e34a7b 100644 (file)
@@ -639,7 +639,7 @@ configure_drag_surface_geometry (GdkSurface *surface)
                               impl->scale);
 }
 
-static void
+static gboolean
 gdk_wayland_surface_compute_size (GdkSurface *surface)
 {
   GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
@@ -655,6 +655,8 @@ gdk_wayland_surface_compute_size (GdkSurface *surface)
 
       impl->next_layout.surface_geometry_dirty = FALSE;
     }
+
+  return FALSE;
 }
 
 static void
index a4b6e5f6ce122a39eabef172b445646f0e2adcce..5e0fc557d81b40bfd0addb2aedcfc0e3493b1962 100644 (file)
@@ -295,7 +295,7 @@ gdk_x11_surface_request_layout (GdkSurface *surface)
     }
 }
 
-static void
+static gboolean
 gdk_x11_surface_compute_size (GdkSurface *surface)
 {
   GdkX11Surface *impl = GDK_X11_SURFACE (surface);
@@ -352,6 +352,8 @@ gdk_x11_surface_compute_size (GdkSurface *surface)
 
       impl->next_layout.surface_geometry_dirty = FALSE;
     }
+
+  return surface->resize_count > 0;
 }
 
 gboolean